package com.gary.springcloud.controller;

import com.gary.springcloud.entity.CommonResult;
import com.gary.springcloud.service.PaymentService;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author peng_rui
 * @date 2022/4/5
 */
@RestController
public class PaymentController {

    @Resource
    private PaymentService paymentService;

    @GetMapping(value = "/provider/hystrix/ok")
    public CommonResult<String> hystrixOk() {
        String s = paymentService.hystrixOk();
        return  new CommonResult<String>(200, s);
    }

    @GetMapping(value = "/provider/hystrix/timeout")
    public CommonResult<String> hystrixTimeout() {
        String s = paymentService.hystrixTimeout();
        return  new CommonResult<String>(200, s);
    }
}
